home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Deutsche Edition 1
/
Deutsche Edition 1.iso
/
amok
/
amok_lha
/
amok20.lha
/
ComplexLib
/
txt
/
FFPComplexInOut.mod
< prev
next >
Wrap
Text File
|
1993-08-15
|
2KB
|
82 lines
(*********************************************************************
:Program. FFPComplexInOut.mod
:Author. Gary Struhlik
:Address. -
:Phone. -
:shortcut. [gs]
:Version. 1.0
:Date. 22.10.1988
:Copyright. PD
:Language. Modula-II
:Translator. M2Amiga
:Imports. FFPComplexLib [gs]
:UpDate. -
:Contents. Ein- Ausgabe für komplexe Zahlen
:Remark. Für den Amiga Modula-2 Klub / Stuttgart
:Remark. Am 01.01.1989 mit M2Amiga 3.2d neu kompiliert
**********************************************************************)
IMPLEMENTATION MODULE FFPComplexInOut;
FROM SYSTEM IMPORT FFP;
FROM FFPComplexLib IMPORT FFPCOMPLEX,cpol,crec;
IMPORT FFPInOut;
FROM InOut IMPORT WriteLn,WriteString;
FROM FFPConversions IMPORT RealToStr;
PROCEDURE WriteComplex( A : FFPCOMPLEX; m,n : INTEGER; expo,pol : BOOLEAN );
VAR
s1,s2 : ARRAY [0..79] OF CHAR;
logo : BOOLEAN;
x : FFP;
Y : FFPCOMPLEX;
BEGIN
IF NOT pol THEN
x:=ABS(A.IM);
RealToStr(A.RE,s1,m,n,expo,logo);
RealToStr(x,s2,m,n,expo,logo);
IF A.IM >= 0.0 THEN
WriteString(s1); WriteString('+j'); WriteString(s2)
ELSE
WriteString(s1); WriteString('-j'); WriteString(s2)
END
ELSE
cpol(Y,A); (* A in Polarform umwandeln *)
RealToStr(Y.RE,s1,m,n,expo,logo);
RealToStr(Y.IM,s2,m,n,expo,logo);
WriteString(s1); WriteString(' <'); WriteString(s2)
END
END WriteComplex;
PROCEDURE ReadComplex( VAR A : FFPCOMPLEX; pol : BOOLEAN);
VAR
X : FFPCOMPLEX;
BEGIN
IF NOT pol THEN
FFPInOut.ReadReal(A.RE); FFPInOut.ReadReal(A.IM)
ELSE
FFPInOut.ReadReal(A.RE); FFPInOut.ReadReal(A.IM);
crec(A,A)
END
END ReadComplex;
PROCEDURE WriteReal( x : FFP; m,n : INTEGER; expo : BOOLEAN);
VAR
s : ARRAY [0..79] OF CHAR;
logo : BOOLEAN;
BEGIN
RealToStr(x,s,m,n,expo,logo);
WriteString(s)
END WriteReal;
PROCEDURE ReadReal( VAR x : FFP);
BEGIN
FFPInOut.ReadReal(x)
END ReadReal;
END FFPComplexInOut.